#pragma once

#include"Common.h"

//线程类
class ThreadCache         
{
public:
	//申请和释放内存对象
	void* Allocate(size_t size);
	void Deallocate(void* ptr, size_t size);

	//归还内存到Span桶中
	void ListToolong(FreeList& list, size_t size);
	//从中心缓存获取对象
	void* FetchFromCentralCache(size_t index, size_t size);
private:
	FreeList _freeLists[NFREELISTS];
};

//加static，当前文件出现，防止多份TLS与obj链接时冲突
static _declspec(thread) ThreadCache* pTLSThreadCache = nullptr;      //静态TLS:线程局部存储


